package com.hqyj.pojo;

import com.baomidou.mybatisplus.annotation.IdType;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import com.baomidou.mybatisplus.annotation.TableId;
import java.io.Serializable;
import java.util.logging.SimpleFormatter;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import lombok.EqualsAndHashCode;

/**
 * <p>
 * 实时消费表
 * </p>
 *
 * @author rock
 * @since 2021-10-21
 */
@Data
@EqualsAndHashCode(callSuper = false)
public class Reservation extends MyPage implements Serializable {

    private static final long serialVersionUID=1L;

    @TableId(value = "reservation_id", type = IdType.AUTO)
    private Integer reservationId;

    private String menberName;

    private Integer orderId;

    private Integer tableId;

    private String reservationState;

    private Date eatTime;


    public String getEatTime() {
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
        if(this.eatTime!=null){
            return sdf.format(this.eatTime);
        }
        return "";
    }

    public void setEatTime(String eatTime) {
        if (eatTime==null||eatTime.equals("")){
            this.eatTime = new Date();
        }else {
            SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
            try {
                this.eatTime = dateFormat.parse(eatTime);
            } catch (ParseException e) {
                e.printStackTrace();
            }
        }
    }
}
